package com.utils.db;


/**
 * class工具类，基于lang3
 * @author: dingjiejun
 * @version: 1.0
 * @date: 2017/3/23
 */
public class ClassUtils extends  org.apache.commons.lang3.ClassUtils {

    public static <T> T getInstance(Class<T> clazz) {
        T t = null;
        try {
            t = clazz.newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return t;
    }

    public static boolean isPresent(String className){
        try {
            ClassUtils.class.getClassLoader().loadClass(className);
            return true;
        } catch (ClassNotFoundException e) {
            return false;
        }
    }

}